package com.ssy.lingxi.after.sale.entity;

import com.ssy.lingxi.after.sale.handler.converter.JpaJsonToIntegerConverter;
import com.ssy.lingxi.after.sale.handler.converter.JpaJsonToProofFileBOConverter;
import com.ssy.lingxi.after.sale.model.bo.ProofFileBO;

import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 维修表
 * @author 伍将
 * @date 2020/9/1
 * @version 2.0.0
 */
@Entity
@Table(schema = "public", name = "as_repair_goods",
        indexes = {@Index(name = "as_repair_goods_member_id_role_id_idx", columnList = "memberId,roleId"),
                @Index(name = "as_repair_goods_parent_member_id_role_id_idx", columnList = "parentMemberId,parentMemberRoleId"),
                @Index(name = "as_repair_goods_inner_status_idx", columnList = "innerStatus"),
                @Index(name = "as_repair_goods_outer_status_idx", columnList = "outerStatus"),
                @Index(name = "as_repair_goods_apply_time_idx", columnList = "applyTime")})
public class RepairGoodsDO implements Serializable {
    private static final long serialVersionUID = 3704007058944019377L;

    /**
     * id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "repair_goods_seq")
    @SequenceGenerator(sequenceName = "as_repair_goods_seq", name = "repair_goods_seq", allocationSize = 1)
    private Long id;

    /**
     * 申请单号
     */
    @Column(columnDefinition = "varchar(20)")
    private String applyNo;

    /**
     * 会员id
     */
    @Column(columnDefinition = "int8")
    private Long memberId;

    /**
     * 会员角色id
     */
    @Column(columnDefinition = "int8")
    private Long roleId;

    /**
     * 采购会员名称
     */
    @Column(columnDefinition = "varchar(50)")
    private String consumerName;

    /**
     * 父级会员id
     */
    @Column(columnDefinition = "int8")
    private Long parentMemberId;

    /**
     * 父级会员角色id
     */
    @Column(columnDefinition = "int8")
    private Long parentMemberRoleId;

    /**
     * 供应商名称
     */
    @Column(columnDefinition = "varchar(50)")
    private String supplierName;
    /**
     * 店铺id
     */
    @Column(columnDefinition = "int8")
    private Long shopId;
    /**
     * 店铺logo
     */
    @Column(columnDefinition = "varchar(512)")
    private String shopLogo;
    /**
     * 店铺名称
     */
    @Column(columnDefinition = "varchar(50)")
    private String shopName;
    /**
     * 任务id
     */
    @Column(columnDefinition = "varchar(50)")
    private String taskId;

    /**
     * 内部工作流当前步骤
     */
    @Column(columnDefinition = "int default 0")
    private Integer innerTaskStep = 0;

    /**
     * 内部工作流步骤记录
     */
    @Convert(converter = JpaJsonToIntegerConverter.class)
    @Column(columnDefinition = "jsonb")
    private List<Integer> innerTaskStepRecord = new ArrayList<>();

    /**
     * 内部状态
     */
    @Column(columnDefinition = "int")
    private Integer innerStatus;

    /**
     * 外部状态
     */
    @Column(columnDefinition = "int")
    private Integer outerStatus;

    /**
     * 申请摘要
     */
    @Column(columnDefinition = "varchar(60)")
    private String applyAbstract;

    /**
     * 维修地址
     */
    @Column(columnDefinition = "varchar(512)")
    private String repairAddress;

    /**
     * 申请时间
     */
    @Column(columnDefinition = "int8")
    private Long applyTime;

    /**
     * 创建时间
     */
    @Column(columnDefinition = "int8")
    private Long createTime;

    /**
     * 更新时间
     */
    @Column(columnDefinition = "int8")
    private Long updateTime;

    /**
     * 证明文件
     */
    @Convert(converter = JpaJsonToProofFileBOConverter.class)
    @Column(columnDefinition = "jsonb")
    private List<ProofFileBO> faultFileList;

    /**
     * 订单类型：取订单表
     */
    @Column(columnDefinition = "int")
    private Integer orderType;

    /**
     * 维修原因
     */
    @Column(columnDefinition = "varchar(30)")
    private String repaireReason;

    /**
     * AgentFlagEnum
     * 代客标识: 0 - 非代客； 1 - 代客
     */
    @Column(columnDefinition = "int")
    private Integer agentFlag;

    public Integer getOrderType() {
        return orderType;
    }

    public void setOrderType(Integer orderType) {
        this.orderType = orderType;
    }

    public String getTaskId() {
        return taskId;
    }

    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getApplyNo() {
        return applyNo;
    }

    public void setApplyNo(String applyNo) {
        this.applyNo = applyNo;
    }

    public Long getMemberId() {
        return memberId;
    }

    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public String getConsumerName() {
        return consumerName;
    }

    public void setConsumerName(String consumerName) {
        this.consumerName = consumerName;
    }

    public Long getParentMemberId() {
        return parentMemberId;
    }

    public void setParentMemberId(Long parentMemberId) {
        this.parentMemberId = parentMemberId;
    }

    public Long getParentMemberRoleId() {
        return parentMemberRoleId;
    }

    public void setParentMemberRoleId(Long parentMemberRoleId) {
        this.parentMemberRoleId = parentMemberRoleId;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    public Long getShopId() {
        return shopId;
    }

    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }

    public String getShopLogo() {
        return shopLogo;
    }

    public void setShopLogo(String shopLogo) {
        this.shopLogo = shopLogo;
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    public Integer getInnerStatus() {
        return innerStatus;
    }

    public void setInnerStatus(Integer innerStatus) {
        this.innerStatus = innerStatus;
    }

    public Integer getOuterStatus() {
        return outerStatus;
    }

    public void setOuterStatus(Integer outerStatus) {
        this.outerStatus = outerStatus;
    }

    public String getApplyAbstract() {
        return applyAbstract;
    }

    public void setApplyAbstract(String applyAbstract) {
        this.applyAbstract = applyAbstract;
    }

    public String getRepairAddress() {
        return repairAddress;
    }

    public void setRepairAddress(String repairAddress) {
        this.repairAddress = repairAddress;
    }

    public Long getApplyTime() {
        return applyTime;
    }

    public void setApplyTime(Long applyTime) {
        this.applyTime = applyTime;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public Long getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Long updateTime) {
        this.updateTime = updateTime;
    }

    public List<ProofFileBO> getFaultFileList() {
        return faultFileList;
    }

    public void setFaultFileList(List<ProofFileBO> faultFileList) {
        this.faultFileList = faultFileList;
    }

    public Integer getInnerTaskStep() {
        return innerTaskStep;
    }

    public void setInnerTaskStep(Integer innerTaskStep) {
        this.innerTaskStep = innerTaskStep;
    }

    public List<Integer> getInnerTaskStepRecord() {
        return innerTaskStepRecord;
    }

    public void setInnerTaskStepRecord(List<Integer> innerTaskStepRecord) {
        this.innerTaskStepRecord = innerTaskStepRecord;
    }

    public String getRepaireReason() {
        return repaireReason;
    }

    public void setRepaireReason(String repaireReason) {
        this.repaireReason = repaireReason;
    }

    public Integer getAgentFlag() {
        return agentFlag;
    }

    public void setAgentFlag(Integer agentFlag) {
        this.agentFlag = agentFlag;
    }
}
